R_MAIN $0400 Resident code. Two JMP's @ $0400 then skip
to $07fc to leave room for screen memory.
This module contains all the code that must
always be available. All the other modules
use the subroutines contained here.
1 R_FILE $4ec7 High level disk file stuff (Rename, Open, etc).
2 R_DA *$75d8 Run's DA's. *Loads inside FG_BUFFER on 64
or SCREEN_BASE on the 128. This keeps it
from overwriting Basic's code.
3 R_INIT $4ec7 geobasic Initialization code. Loaded from
Resident code.
4 R_LOAD $7501 Basic Program loader. Loads into FG_BUFFER
(see R_DA).
5 R_BINT $4f96 Interpreter (BasRes). This is the module that
actually runs the user's program.
6 R_BINT2 $0400
7 R_FONT $6f8b Font Manager (cFont, cSysInfo, and
GetDiskBitmap).
8 R_DISK $6f8b Lower level disk stuff (reading bytes, etc).
9 R_PRINT $6f8b Printer Routines.
10 R_MENU $4ec7 Menu Utility.
11 R_DBOX $4ec7 Dialog Box Utility.
12 R_ICON $4ec7 Icon Utility.
13 R_BMAP $4ec7 Bitmap Utility.
14 R_SPRT $4ec7 Sprite Utility.
15 R_EDIT $4503 Editor.
16 R_APPL $4b00 Make Application (run-time).
17 R_DEBUG $47cc Debugger.
@GB Program, Disk Layout
@Records 0 to 9 -
left empty to leave room for GB code when making run-time.
@Record #10 -
VLIR table. Keeps track of what modules hold what line #'s. Used for doing the VLIR splitting. The table is a single sector and there is one eight byte entry for each program module. The entries have the following format:
.word ? ; Highest line number in module.
.word ? ; Length_of_module (in bytes)
.byte ? ; nesting_level
.byte ? ; write_status
.byte ? ; modified_status
.byte NULL ; terminator
The very first entry is a bit different. It looks like this:
.word ??? ; (NULLS)
.byte x ; number of entries in the VLIR table (not
; counting this one which is entry #0).
.byte x ; number of labels in the label table (minus 1,
; labels are numbered from zero!). If there
; are no labels then it equals $ff.
.byte $f0?
.byte $f6?
.word ???
@Record #11 -
Object table. All of the geos objects are store in this record, one right after the other.
@Record #12 -
Label Table. Here is where the labels (@xxxx and object names) are stored. Each label entry is 8 bytes long and has the following format:
.word address ; where in memory the object is located.
@Record #13 onward -
Holds the basic program lines. Each line has the following format:
.byte ; length_of_line
.word ; line_number
.block ??? ; now comes the tokenized text
.byte NULL ; terminator
@Record #126 backward -
Disk loadable bitmaps are stored beginning at record #126. Additional bitmaps are added backwards until they meet up with the program records. Note that
disk loadable bitmaps are stored here. Regular bitmaps are stored in the Object Table (record #11).
@Getting Registers after a CALL:
After using the CALL command use can get the return values of the registers by PEEKing the following memory locations:
@A =
$28a (650)
@X =
$28b (651)
@Y =
$28c (652)
@SR =
$28d (653)
@POP Command:
The old (V1.0) Pop command had several serious bugs that caused a system crash. The new version works like this: executing a POP will remove the current GOSUB/WHILE/REPEAT stack frame. In other words it will allow you to 'forget' that you are in a subroutine or loop (this does not apply to a FOR...NEXT loop). One thing to keep in mind is that after executing a POP you must not allow the program to reach the RETURN/LOOP/UNTIL commands. The best way of doing this is with a construct like this:
10 GOSUB DoSomething
20 END
50 @DoSomething
60 <various commands>
70 IF something = error THEN POP : GOTO @DoError
80 RETURN
100 @DoError
110 .... etc
Of course if you are two levels deep in a subroutine and execute a POP, then you execute a RETURN the program will return TWO levels back rather then just one. Could come in handy at times.
@GB Variables - zero page
Name Address Size Description
basCur $81/129 word current character in basic memory
basBegin $83/131 word pointer to beginning of basic
basicEnd $85/133 word pointer to beginning of labels (minus 1
for end of basic)
varBegin $87/135 word pointer to the beginning of variables
arrayBegin $89/137 word pointer to the beginning of arrays
arrayEnd $8b/139 word pointer to the end of arrays
arrayLength $8d/141 word length of array/temporary register
strnBegin $8f/143 word pointer to the beginning of strings
zeroShift $91/145 byte used by floating point routines
dec_pt $92/146 byte used by floating point routines
varPtr $93/147 word pointer to value of variable
machine_type $95/149 byte 0 if c64, $80 if 128
strnStack $96/150 9 bytes stack for three temp string descriptors
strnStkIndx $9f/159 byte index into strnStack
prevStrnStkIndx $a0/160 byte previous strnStack index
rdIndex $a1/161 byte index to reading in strings
gax2 $a2/162 word (not commented in source code)
curStrn $a4/164 word pointer to most current string that
was added or moved.
strnDes $a6/166 word pointer to string descriptor
descPtr $a8/168 word pointer to string descriptor for string
operations.
geosBegin $aa/170 word pointer to the beginning of object
(menus, icons, etc.) data.
memAmnt $ac/172 word amount of memory to insert or delete
curKeyBrdPos $ae/174 word (not commented in source)
SetForIOTemp $b0/176 word (not commented in source)
curLineNum $b2/178 word current line number being executed or
$ff in direct mode
VLIRtabl $b4/180 word pointer to beginning of VLIR table
xPos $b6/182 word X position for PRINT
yPos $b8/184 byte Y position for PRINT
opMask $b9/185 byte current comparison being performed
>/1, =/2, </4 or any combo of these
comm_Flag $ba/186 byte flag for which command is currently
being executed: 0 = none, 1 = RUN,
-1 = LIST - used by the Editor
dataPtr $bc/188 word pointer in basic to DATA statements
FP_sgns $be/190 byte temp flag for sign of FP number
exp_found $bf/191 byte flag for whether exponent was found
fontBegin $c0/192 word pointer to beginning of font
lastFontPtr $c2/194 word (not commented in source)
curDBPtr $c4/196 word pointer to current dialog box data